<?php
namespace Admin\Model;
use Think\Model;

class CommonModel extends Model{
	public $autoCheckFields = false;
	/**
	 * 获取记录字段值
	 * @param  string $model [description]
	 * @param  [type] $id    [description]
	 * @return [type]        [description]
	 */
	public function get_field_val($model = 'Link', $id = '', $field='title'){
		$where['id'] = $id;
		return D($model)->where($where)->getField($field);
	}
	public function add_tags($module = 'article', $field = 'tags_id', $join_id = '', $tags_id = ''){
		$data['module']  = $module;
		$data['field']   = $field;
		$data['join_id'] = $join_id;
		$data['tags_id'] = $tags_id;
		D('TagsJoin')->add($data);
	}
	public function delete_tags($module = 'article', $field = 'tags_id', $join_id = ''){
		$where['module']  = $module;
		$where['field']   = $field;
		$where['join_id'] = $join_id;
		D('TagsJoin')->where($where)->delete();
	}
}